<template>
  <div class="project-box">
    <div class="left">
      <img :src="imgUrl" alt="图片正在加载中......" />
    </div>
    <div class="right">
      <div class="top">
        <h2>项目名称：{{projectData.name}}</h2>
        <template v-if="projectData.source_url">
          <a :href="projectData.source_url">点击跳转到源码仓库</a>
        </template>
        <template v-if="projectData.online_url">
          <a :href="projectData.online_url">在线演示</a>
        </template>
      </div>
      <div class="bottom">
        <h2>项目介绍：</h2>
        <div class="introduce">
          <p>{{projectData.introduce}}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue"
import getSomeImage from "../../../utils/getSomeImage"
const props = defineProps({
  projectData: {
    type: Object,
    default: {}
  }
})
const imgUrl = ref("")
getSomeImage().then(res => {
  imgUrl.value = res[0]
})
</script>

<style scoped>
  .project-box {
    font-family:Georgia, 'Times New Roman', Times, serif;
    display: flex;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
    height: 400px;
    background-color: antiquewhite;
    border-radius: 10px;
    margin: 20px;
  }
  .left {
    width: 40%;
    background-color: pink;
    border-radius: 10px;
    overflow: hidden;
  }
  .left img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .right {
    padding-left: 20px;
    box-sizing: border-box;
    width: 60%;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
  }

  .right .top {
    height: 50px;
    display: flex;
    justify-content: space-between;
  }
  .right .bottom {
    height: 310px;
    overflow: hidden;
    text-align: justify;
    text-overflow: ellipsis;
  }
  .introduce p {
    text-indent: 1.5em;
    font-size: 16px;
    line-height: 22px;
    letter-spacing: 2px;
  }
</style>
